-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CORE] OV file utils file_size use std file path #28462
base: master
Are you sure you want to change the base?
[CORE] OV file utils file_size use std file path #28462
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions are not cast rename file or keep them in original header.
Why these function are moved to new file?
#if defined(GCC_VER_LESS_THEN_12_3) || defined(CLANG_VER_LESS_THEN_17) | ||
inline ov::util::Path WPath(const std::wstring& wpath) { | ||
return {ov::util::wstring_to_string(wpath)}; | ||
} | ||
#else | ||
inline ov::util::Path WPath(const std::wstring& wpath) { | ||
return {wpath}; | ||
} | ||
#endif | ||
|
||
} // namespace util | ||
} // namespace ov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if defined(GCC_VER_LESS_THEN_12_3) || defined(CLANG_VER_LESS_THEN_17) | |
inline ov::util::Path WPath(const std::wstring& wpath) { | |
return {ov::util::wstring_to_string(wpath)}; | |
} | |
#else | |
inline ov::util::Path WPath(const std::wstring& wpath) { | |
return {wpath}; | |
} | |
#endif | |
} // namespace util | |
} // namespace ov | |
} // namespace util | |
} // namespace ov | |
#if defined(GCC_VER_LESS_THEN_12_3) || defined(CLANG_VER_LESS_THEN_17) | |
template<> | |
ov::util::Path::path<std::wstring>(const std::wstring& source, format fmt) : path(ov::util::wstring_to_string(source), std::move(fmt)) {} | |
#endif |
Consider add specialization for compiler version where is bug with path creation then WPath
function is not required and path can be create always in same way.
Optionally: If any issue because specialization already defined add some trait check to detect it and avoid define it in OV.
@@ -172,26 +161,30 @@ bool directory_exists(const std::string& path); | |||
bool directory_exists(const std::wstring& path); | |||
#endif | |||
|
|||
inline ov::util::Path cut_android_path(const ov::util::Path& file_name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not required can be still internal part of file_size
if (pos != std::string::npos) { | ||
file_name = file_name.substr(0, pos); | ||
} | ||
inline int64_t file_size(const ov::util::Path& path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline int64_t file_size(const ov::util::Path& path) { | |
inline int64_t file_size(const ov::util::Path& path) { | |
#if defined(__ANDROID__) || defined(ANDROID) | |
// apply cuting if std::filesytem not support it well. | |
#endif | |
return std::filesystem::file_size(path); | |
} |
This function should probably be wrapper to std
implementation if works.
refactor to use structured bindings
/** | ||
* @brief Returns file size for file | ||
* @param[in] path The file name | ||
* @return file size | ||
*/ | ||
[[deprecated( | ||
"This function is deprecated use file_size(const ov::util::Path& path) instead. Will be removed in 2026.0")]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's internal function (not given to end users) and can be removed right now (if it does not have other users)
Details:
Tickets: